﻿<!--#include file="../base.asp"-->
<!--#include file="FCKeditor/fckeditor.asp" -->
<%if checkIP("add_work") then %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>编辑作业</title>
<link href="../skin/default/main.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
//检查页面内容完整性
function check()
{
    var re = /^[1-9]\d{3}-\d{1,2}-\d{1,2}$/;     
    if(document.getElementById("startDate").value=="")
    {
        alert("开始日期不能为空！");
        return false;
    }
    if(document.getElementById("stopDate").value=="")
    {
        alert("截止日期不能为空！");
        return false;
    }
    if(!re.test(document.getElementById("startDate").value))
    {
        alert("开始日期格式不正确！");
        return false;
    }
    if(!re.test(document.getElementById("stopDate").value))
    {
        alert("截止日期格式不正确！");
        return false;
    }
    if(document.getElementById("title").value=="")
    {
        alert("标题不能为空！");
        return false;
    }
    return true;
}
//显示日历
function showCalender()
{
    var today=new Date();
    var year=today.getYear();
    var month=today.getMonth()+1;
    var day=today.getDate();
    today=year+"-"+month+"-"+day;
    var obj=event.srcElement;
    var mouX = window.event.screenX;
    var mouY = window.event.screenY;
    var temp=showModalDialog("calender.htm",window,"dialogTop:"+mouY+"px;dialogLeft:"+mouX+"px;dialogWidth:0px;dialogHeight:140px");
    if(temp==undefined || temp=="") temp=today;
    else obj.value=temp;
    if(obj.value=="") obj.value=temp;
}
</script>
</head>

<body>
<%
dim contid,sql,rs,rsCont
contid=request.QueryString("contid")

if contid<>"" then
sql="select * from [work] where workID="&contid&" and [delete]=0"
set rs=GetRecordset(sql,0)
end if
%>
<form action="<%
if contid<>"" then
    response.write("save_work.asp?contid="&contid)
else response.write("save_work.asp")
end if
%>" method="post">
<table border="0" width="100%">
<tr><td colspan="4">
<%
if contid="" then
%>
添加作业
<%
else
%>
修改作业
<%
end if
%>
</td></tr>
  <tr>
    <td>
        开始日期：</td>    
    <td><input type="text" id="startDate" name="startDate" onclick="showCalender()" value="<%
        if contid<>"" then
            response.write(rs("startDate"))
        end if
    %>" /><br />(如：1900-1-1)</td>    
    <td>
        截止日期：</td>    
    <td><input type="text" id="stopDate" name="stopDate" onclick="showCalender()" value="<%
        if contid<>"" then
            response.write(rs("stopDate"))
        end if
    %>" /><br />(如：1900-1-1)</td>    
  </tr>
  <tr><td class="td_vlign">标题：</td><td><input type="text" size="30" id="title" name="title" value="<%
        if contid<>"" then
            response.write(rs("title"))
        end if
    %>" /></td>
    <td>开启/关闭留言：</td><td>
    <%
    if contid<>"" then
    if rs("discussAble")="True" then
    %>   
    <input id="ckbDiscuss" name="ckbDiscuss" type="checkbox" checked="checked" />开启留言
    <%
    else
    %>
    <input id="ckbDiscuss" name="ckbDiscuss" type="checkbox" />开启留言
    <%
    end if
    else
    %>
    <input id="ckbDiscuss" name="ckbDiscuss" type="checkbox" />开启留言
    <%
    end if
    %>
    </td>
    </tr>
  <tr>
    <td class="td_vlign" style="vertical-align:top;">内容：</td>
    <td colspan="3">
    <%
         Dim sBasePath
         sBasePath = "fckeditor/"
         Dim oFCKeditor
         Set oFCKeditor = New FCKeditor
         oFCKeditor.BasePath	= sBasePath
         oFCKeditor.Config("AutoDetectLanguage") = False
         oFCKeditor.Config("DefaultLanguage")    = "zh-cn"
         if contid<>"" then
            oFCKeditor.Value	= rs("content")
            rs.close
            set rs=nothing
            CloseDataBase
         else
            oFCKeditor.Value	= ""
         end if
         oFCKeditor.Create "content"
  	%>
  	</td>
  </tr>
  <tr>
    <td>上传：</td>
    <td colspan="3"><iframe src="upload.asp" width="100%" height="24" frameborder="0" scrolling="no"></iframe></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="3">&nbsp;<input type="submit" value="提交" onclick="return check()" />&nbsp;&nbsp;<input type="reset" value="重置" /></td>
  </tr>
</table>
</form>
</body>
</html>
<%end if %>